<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>{{title}}</title>
     {% include "include/head.html" %}
</head>
<body>
    <h2>{{title}}</h2>
    <div>
            {% if entries %}
                <table class="table border">
                <thead>
                    <tr>
                        <th>id</th>
                        <th>name</th>
                        <th>price</th>
                        <th>bookCount</th>
                        <th>author</th>
                    </tr>
                </thead>
                    {% for entrie in entries%}
                        <tr>
                            <td>{{ entrie.id}}</td>
                            <td><a href="?id={{ entrie.id}}">{{ entrie.name}}</a></td>
                            <td>{{ entrie.price}}</td>
                            <td>{{ entrie.bookCount}}</td>
                            <td>{{ entrie.author}}</td>
                        </tr>
                     {% end %}
                </table>
                <a href='/addData' class="btn btn-default">addData</a>
            {% elif entries2 %}
                <form class="form-horizontal" role="form" method="post" action="/database">
                    <div class="form-group">
                        <label for="entriesId" class="col-sm-2 control-label">id:</label>
                        <div class="col-sm-10">
                            <input type="text" id="entriesId" readonly class="form-control" value="{{ entries2.id}}" name="id" placeholder="id"/>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="entriesName" class="col-sm-2 control-label">name:</label>
                        <div class="col-sm-10">
                           <input type="text" id="entriesName" class="form-control" value="{{ entries2.name}}" name="name" placeholder="name"/>
                        </div>
                    </div>

                      <div class="form-group">
                        <label for="entriesprice" class="col-sm-2 control-label">price:</label>
                        <div class="col-sm-10">
                           <input type="text" id="entriesprice" class="form-control" value="{{ entries2.price}}" name="price" placeholder="price"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="entriesbookCount" class="col-sm-2 control-label">bookCount:</label>
                        <div class="col-sm-10">
                           <input type="text" id="entriesbookCount" class="form-control" value="{{ entries2.bookCount}}" name="bookCount" placeholder="bookCount"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <label for="entriesbookauthor" class="col-sm-2 control-label">author:</label>
                        <div class="col-sm-10">
                           <input type="text" id="entriesbookauthor" class="form-control" value="{{ entries2.author}}" name="author" placeholder="author"/>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <button type="submit" class="btn btn-default">save</button>
                            <button type="button" id="delBtn" class="btn btn-default">delete</button>
                        </div>
                    </div>
                    {% module xsrf_form_html() %}
                </form>

            {% else %}
                <div>
                    None
                </div>
            {% end%}
    </div>
    <script data-main="{{ static_url(WEB_RRESOURCE_DIR +'/js/home.js') }}" src="{{ static_url(WEB_RRESOURCE_DIR +'/js/require.min.js') }}" type="text/javascript"></script>
    </body>
</html>
